/**
 * 
 */
package model;

import java.util.List;

/**
 * Stores and allows easy access to vital attributes of a food recipe.
 * 
 * @author
 */
public class Recipe {
	private int my_recipeID;
    private String my_title;
    private String my_author;
    private String my_description;
    private String my_picture;
    private String my_notes;
    private String my_difficulty;
    private Integer my_servingSize;
    private Integer my_prepTime;
    private Integer my_cookTime;
    
    private List<RecipeIngredient> my_ingredients;
    private List<RecipeStep> my_steps;
    
    /**
     * 
     */
    public Recipe(String the_title, String the_author, int the_prep, int the_cook, 
                  int the_servingSize, String the_level, String the_picture, String the_notes, 
                  List<RecipeIngredient> the_ingredients, List<RecipeStep> the_steps) {
        my_title = the_title;
        my_author = the_author;
        my_notes = the_notes;
        my_difficulty = the_level;
        my_servingSize = the_servingSize;
        my_prepTime = the_prep;
        my_cookTime = the_cook;
    	my_ingredients = the_ingredients;
    	my_steps = the_steps;
    	my_picture = the_picture;
    }
  
    /** Constructor used by the database **/
    public Recipe(int the_recipeID, String the_title, String the_author, String the_description, String the_notes, String the_difficulty,
    		Integer the_servingSize, Integer the_prepTime, Integer the_cookTime, String the_picture) {
    	
    	my_recipeID = the_recipeID;
        my_title = the_title;
        my_author = the_author;
        my_description = the_description;
        my_notes = the_notes;
        my_difficulty = the_difficulty;
        my_servingSize = the_servingSize;
        my_prepTime = the_prepTime;
        my_cookTime = the_cookTime;
        my_picture = the_picture;
    }
    
    //Test constructor for GUI
    public Recipe(String the_title, int the_prep, int the_cook, String the_difficulty, String the_picture) {
        my_title = the_title;
        my_difficulty = the_difficulty;
        my_prepTime = the_prep;
        my_cookTime = the_cook;
        my_picture = the_picture;
    }
    
    public void addIngredients(List<RecipeIngredient> ingredients) {
    	my_ingredients = ingredients;
    }
    
    public void addSteps(List<RecipeStep> steps) {
    	my_steps = steps;
    }
    public int getID() {
    	return my_recipeID;
    }
    
    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    public String toString() {
    	String recipe = "";
    	if(my_title != null) {
    		recipe += "Title: " + my_title + "\n";
    	}
    	if(my_author != null) {
    		recipe += "Author: " + my_author + "\n";
    	}
    	if(my_description != null) {
    		recipe += "Description: " + my_description + "\n";
    	}
    	if(my_notes != null) {
    		recipe += "Notes: " + my_notes + "\n";
    	}
    	if(my_difficulty != null) {
    		recipe += "Difficulty: " + my_difficulty + "\n";
    	}
    	if(my_servingSize != null) {
    		recipe += "Serving Size: " + my_servingSize + "\n";
    	}
    	if(my_prepTime != null) {
    		recipe += "Prep Time: " + my_prepTime + "\n";
    	}
    	if(my_cookTime != null) {
    		recipe += "Cook Time: " + my_cookTime + "\n";
    	}
    	for(int i = 0; i < my_steps.size(); i++) {
    		recipe += (i + 1) + ": " + my_steps.get(i).getDirections() + "\n";
    	}
    	recipe += "Ingredients: \n";
    	for(int i = 0; i < my_ingredients.size(); i++) {
    		recipe +=  my_ingredients.get(i).getIngredient() + "\n";
    	}
    	recipe += "\n";
    	return recipe;
    	
    }
    public List<RecipeStep> getSteps() {
        return my_steps;
    }   
    public List<RecipeIngredient> getIngredients() {
        return my_ingredients;
    }
    public String getTitle() {
        return my_title;
    }
    public String getDifficulty() {
        return my_difficulty;
    }
    public int getPrepTime() {
        return my_prepTime;
    }
    public int getCookTime() {
        return my_cookTime;
    }
    public String getPicture() {
        return my_picture;
    }
    public String getAuthor() {
        return my_author;
    }
    public int getServes() {
        return my_servingSize;
    }
 
}
